
public class RaceCar extends Thread{

	private int finish;
	public String name;
	private int x=0;
	private int barra;

	public RaceCar(int i, int j, String s){
		finish=i;
		name=s;
		barra=j;
	}
	
	
	public void run()
	{
		for(x=0;x<=finish;x++){
			   Race.progress[barra].setValue(x);
			   Race.progress[barra].setString("Vuelta "+x);
			   Race.progress[barra].repaint();
			try{
				Thread.sleep(((int)(Math.random()*5)*1000));
			}catch(InterruptedException e){}
		}
		Race.progress[barra].setString("Finished");
		Race.arrived(name);
	}

}
